package com.unionpay.upyzt.consts;

import com.google.gson.annotations.SerializedName;
import lombok.Getter;

/**
 * 电子账簿(余额账户)类型
 */
@Getter
public enum AcctTypeEnum {
    /**
     * 0: 基本户
     */
    @SerializedName(value = "basic")
    BASIC(0, "basic"),
    /**
     * 1: 挂帐户
     */
    @SerializedName(value = "charge")
    CHARGE(1, "charge"),
    /**
     * 2: 手续费户
     */
    @SerializedName(value = "fee")
    FEE(2, "fee"),
    /**
     * 3: 充值户
     */
    @SerializedName(value = "deposit")
    DEPOSIT(3, "deposit"),
    /**
     * 4: 提现在途户
     */
    @SerializedName(value = "withdrawal")
    WITHDRAWAL(4, "withdrawal"),
    /**
     * 5: 担保户
     */
    @SerializedName(value = "guarantee")
    GUARANTEE(5, "guarantee"),
    /**
     * 6: 垫资户
     */
    @SerializedName(value = "guarantee")
    ADVANCE(6, "advance"),
    /**
     * 7: 营销户
     */
    @SerializedName(value = "marketing")
    MARKETING(7, "marketing"),
    /**
     * 8: 汇总可提现户
     */
    @SerializedName(value = "bank_fund")
    BANK_FUND(8, "bank_fund"),
    ;
    private final Integer code;
    private final String value;


    AcctTypeEnum(Integer code, String value) {
        this.code = code;
        this.value = value;
    }


    public AcctTypeEnum getByValue(String value) {
        for (AcctTypeEnum acctType : AcctTypeEnum.values()) {
            if (acctType.getValue().equals(value)) {
                return acctType;
            }
        }
        return null;
    }
}
